@@ -74,7 +74,7 @@ class AdminPanelController < ApplicationController |
||
| 74 | 74 |
|
| 75 | 75 |
# Never trust parameters from the scary internet, only allow the white list through. |
| 76 | 76 |
def info_params |
| 77 |
- params.require(:info).permit(:website_name, :tagline, :contact_email, :default_language, :maintenance_mode, :maintenance_title, :maintenance_message) |
|
| 77 |
+ params.require(:info).permit(:website_name, :website_link, :tagline, :contact_email, :default_language, :maintenance_mode, :maintenance_title, :maintenance_message) |
|
| 78 | 78 |
end |
| 79 | 79 |
|
| 80 | 80 |
def authenticate_user |
@@ -18,10 +18,10 @@ class ContactMessagesController < ApplicationController |
||
| 18 | 18 |
respond_to do |format| |
| 19 | 19 |
if @contact_message.save |
| 20 | 20 |
UserMailer.contact_message(@contact_message).deliver |
| 21 |
- format.html { redirect_to @contact_message, notice: 'Contact message was successfully created.' }
|
|
| 21 |
+ format.html { redirect_to contact_messages_path, notice: (t 'contact.delivered') }
|
|
| 22 | 22 |
format.json { render action: 'show', status: :created, location: @contact_message }
|
| 23 | 23 |
else |
| 24 |
- format.html { render action: 'new' }
|
|
| 24 |
+ format.html { redirect_to contact_path, alert: (t 'contact.not_delivered') }
|
|
| 25 | 25 |
format.json { render json: @contact_message.errors, status: :unprocessable_entity }
|
| 26 | 26 |
end |
| 27 | 27 |
end |
@@ -12,6 +12,7 @@ |
||
| 12 | 12 |
<div class="form-inputs"> |
| 13 | 13 |
<%= f.text_field :website_name, :label => (t 'admin_panel.website_name'), class:'input-xlarge' %> |
| 14 | 14 |
<%= f.text_field :tagline, :label => (t 'admin_panel.tagline'), class: 'input-xxlarge' %> |
| 15 |
+ <%= f.text_field :website_link, :label => (t 'admin_panel.website_link'), class:'input-xlarge' %> |
|
| 15 | 16 |
<%= f.select :default_language, ["en", "pt-BR"], :label => (t 'admin_panel.default_language'), help: ("<i>* "+(t "admin_panel.language_hint")+"</i>").html_safe %>
|
| 16 | 17 |
<%= f.email_field :contact_email, :label => (t 'admin_panel.contact_email'), class:'input-xlarge' %> |
| 17 | 18 |
<hr> |
@@ -221,8 +221,9 @@ Email on Acid - http://www.emailonacid.com/blog/details/C18/doctype_-_the_black_ |
||
| 221 | 221 |
|
| 222 | 222 |
<!-- End example table --> |
| 223 | 223 |
|
| 224 |
- <p><%= @msg.content %></p> |
|
| 225 |
- |
|
| 224 |
+ <p><%= simple_format @msg.content %></p> |
|
| 225 |
+ <hr> |
|
| 226 |
+ <p><i>Mensagem enviada pelo site <%= @config.website_link != nil ? (link_to @config.website_name, @config.website_link) : @config.website_name %>.</i></p> |
|
| 226 | 227 |
</td> |
| 227 | 228 |
</tr> |
| 228 | 229 |
</table> |
@@ -215,6 +215,7 @@ en: |
||
| 215 | 215 |
configurations: Configurations |
| 216 | 216 |
language_hint: Wait a few seconds for changes to take effect |
| 217 | 217 |
website_name: Website Name |
| 218 |
+ website_link: Website URL |
|
| 218 | 219 |
tagline: Tagline |
| 219 | 220 |
default_language: Default Language |
| 220 | 221 |
update_config_btn: Update Config |
@@ -267,6 +268,8 @@ en: |
||
| 267 | 268 |
send: Send |
| 268 | 269 |
error: Please correct the following errors |
| 269 | 270 |
by: by |
| 271 |
+ delivered: Message sent! |
|
| 272 |
+ not_delivered: There was an error and the message was not sent. |
|
| 270 | 273 |
registration: |
| 271 | 274 |
sign_in: Sign In |
| 272 | 275 |
sign_up: Sign Up |
@@ -218,6 +218,7 @@ pt-BR: |
||
| 218 | 218 |
language_hint: Espere alguns segundos para as mudanças ocorrerem |
| 219 | 219 |
config_update_success: As configurações foram atualizadas com sucesso. |
| 220 | 220 |
website_name: Nome do Site |
| 221 |
+ website_link: Link do Site |
|
| 221 | 222 |
tagline: Tagline |
| 222 | 223 |
default_language: Lingua padrão |
| 223 | 224 |
update_config_btn: Salvar Configurações |
@@ -269,6 +270,8 @@ pt-BR: |
||
| 269 | 270 |
send: Enviar |
| 270 | 271 |
error: Favor corrigir os erros abaixo |
| 271 | 272 |
by: por |
| 273 |
+ delivered: Mensagem enviada com sucesso. |
|
| 274 |
+ not_delivered: Ocorreu um erro e a mensagem não enviada. |
|
| 272 | 275 |
registration: |
| 273 | 276 |
sign_in: Entrar |
| 274 | 277 |
sign_up: Cadastro |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 |
RailsWebsiteTemplate::Application.routes.draw do |
| 2 | 2 |
|
| 3 |
- resources :contact_messages, path: '/contact' |
|
| 3 |
+ resources :contact_messages, path: '/contact', :as => :contact_messages |
|
| 4 | 4 |
|
| 5 | 5 |
resources :uploads |
| 6 | 6 |
|
@@ -0,0 +1,5 @@ |
||
| 1 |
+class AddLinkToInfos < ActiveRecord::Migration |
|
| 2 |
+ def change |
|
| 3 |
+ add_column :infos, :website_link, :string |
|
| 4 |
+ end |
|
| 5 |
+end |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 |
# |
| 12 | 12 |
# It's strongly recommended that you check this file into your version control system. |
| 13 | 13 |
|
| 14 |
-ActiveRecord::Schema.define(version: 20141031021236) do |
|
| 14 |
+ActiveRecord::Schema.define(version: 20141101234157) do |
|
| 15 | 15 |
|
| 16 | 16 |
# These are extensions that must be enabled in order to support this database |
| 17 | 17 |
enable_extension "plpgsql" |
@@ -67,6 +67,7 @@ ActiveRecord::Schema.define(version: 20141031021236) do |
||
| 67 | 67 |
t.boolean "maintenance_mode" |
| 68 | 68 |
t.string "maintenance_title" |
| 69 | 69 |
t.text "maintenance_message" |
| 70 |
+ t.string "website_link" |
|
| 70 | 71 |
end |
| 71 | 72 |
|
| 72 | 73 |
create_table "uploads", force: true do |t| |